/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package vn.webapp.service;

import java.util.ArrayList;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.core.userdetails.UserDetailsService;
import org.springframework.security.core.userdetails.UsernameNotFoundException;
import org.springframework.stereotype.Service;
import vn.webapp.dao.ClassingDAO;
import vn.webapp.dto.DataPage;
import vn.webapp.model.Classing;

@Service("classingService")
public class ClassingServiceImpl implements ClassingService {

    @Autowired
    private ClassingDAO classingDAO;

    public void setClassingDAO(ClassingDAO classingDAO) {
        this.classingDAO = classingDAO;
    }
    
    @Override
    public int removeAClassing(int id){
        return classingDAO.removeAClassing(id);
    }
    
    @Override
    public Classing checkExists(int id, int courseteacherid, int classId){
        // return coursingDAO.checkExists(id, courseteacherid, classId);
        return new Classing();
    }
    
    @Override
    public int saveAClassing(int courseteacherid, int classId){
        Classing classing = new Classing();
        classing.setCourseteacher_id(courseteacherid);
        classing.setClass_id(classId);
        return classingDAO.saveAClassing(classing);
    }

    @Override
    public void editAClassing(int id, int courseteacherid, int classId){
        
        Classing classing = new Classing();
        classing.setCourseteacherclass_id(id);
        //classing.setCourseteacherid(courseteacherid);
        classing.setClass_id(classId);
        
        classingDAO.editAClassing(classing);
    }
    
    @Override
    public Classing getAClassingByCourseAndClassId(int courseId, int classId)
    {
        int id = 0;
        return classingDAO.getAClassingByCourseAndClassId(id , courseId, classId);
    }
}
